< previous page page_177 next page >

Page 177
If you create a TestClass class module and a modMain module with the methods in Listing 8.1, and you run the example as is, SomeArgument will lead to a successful pass of program execution. The correct type will be returned. However, if you comment the Integer version of SomeArgument and uncomment the String version, the return type will not be passed back, meaning that localTestClass will never be initialized with the return object. However, even in this potentially embarrassing situation, the elegant return-type checking mechanism ensures that non-Integer arguments will not lead to an unexpected object being returned.
New Term: Positive testing is a testing activity that seeks a desirable result given a request for service. Negative testing, on the other hand, is a testing activity that seeks an undesirable result given a request for service.
Designing Business Logic Constraint Checking into VB Classes
Business rule logic encompasses any preconditions and postconditions that are specific to a given business. Thus, in the Second Bank of Carrollton example, a rule could be that any checking account must be a valid bank product, of which Basic Personal Checking is one. Or the bank might require that all new savings accounts must be opened with a minimum of $100.00. Day 15, The Business Rules Subsystem, goes into greater detail about business rules. Here you are only interested in looking at a method that has such a constraint built into it. The next section shows a simple example of a business rule logic that you can check.
The Samsona Bank Teller System Example
The branch manager of Second Bank of Carrollton just remembered two important business rules that she forgot to mention. The application you're building for her needs to capture, in the case of deposit transactions, whether cash or a check is being deposited. If the transaction involves cash, the bank must enforce federal law for deposits of $10,000 or more. This means that the application must check for this limit for every cash deposit transaction. If the transaction involves a check, the date the funds are available is by default ten business days (unless the teller comes across a situation that requires overriding of this rulelet's ignore this complexity for this example).
Let's use the classes from the ActiveX component project developed on Day 6.
Listing 8.2 shows the enhanced Deposit class. Notice the three new properties, FundsAvailabilityDate (line 52), DepositType (line 65), and TransactionDate

 
< previous page page_177 next page >

If you like this book, buy it!